#include "processbar.h"
#include <unistd.h>
#define START "\033[1;31m"
#define END "\033[0m"
const char* symbol = "|/-\\";

void processbar()
{
  int len = strlen(symbol);
  int cnt = 0;
  char bar[NUM];
  memset(bar,'\0',sizeof(bar));
  while(cnt <= 100)
  {
    printf(START"[%-100s]"END"[%d%%][%c]\r",bar,cnt,symbol[cnt % len]);
    fflush(stdout);
    bar[cnt++] = BODY;
    if (cnt < 100)
      bar[cnt] = end;
    usleep(50000);
  }
  printf("\n");
}
